x = decrypt(frmAutoUpdate.txtKeyPhrase.Text, GetIni(frmAutoUpdate.txtKeyFile.Text, "data", "URL-to-download"))
lbldownload.Caption = x
x = decrypt(frmAutoUpdate.txtKeyPhrase.Text, GetIni(frmAutoUpdate.txtKeyFile.Text, "data", "URL-to-remversion"))
lblremote.Caption = x
x = decrypt(frmAutoUpdate.txtKeyPhrase.Text, GetIni(frmAutoUpdate.txtKeyFile.Text, "data", "Exe-of-Update"))
lblexeupdate.Caption = x
x = decrypt(frmAutoUpdate.txtKeyPhrase.Text, GetIni(frmAutoUpdate.txtKeyFile.Text, "data", "Exe-of-Program"))
lblexeprogram.Caption = x
Let exeupdate = lblexeupdate.Caption
Let exeprogram = lblexeprogram.Caption
'1. Open the local version file and read in the number
Open App.Path & "\curversion.dat" For Input As #1
intLocalVer = CInt(Input(LOF(1), 1))
Close 1
imgcircle4.Visible = False
Label4.Enabled = False
imgcircle1.Visible = True
Label1.Enabled = True
'2. Download the remote version file and read in the number
' Note: This is all one line:
b() = InetUpdate.OpenURL(lblremote.Caption, 1)
'InetUpdate.Execute lblremote.Caption
strRemoteVer = ""
For T = 0 To UBound(b)
strRemoteVer = strRemoteVer + Chr(b(T))
intRemoteVer = Int(strRemoteVer)
'3. Compare numbers
imgcircle1.Visible = False
Label1.Enabled = False
imgcircle2.Visible = True
Label2.Enabled = True
If intRemoteVer > intLocalVer Then
'Note: This is all one line:
If MsgBox("A more recent version of this program exists. Would you like to update it now?", vbYesNo Or vbQuestion) = vbYes Then
doUpdate = True
doUpdate = False
End If
MsgBox "You already have the most recent version of this program."
doUpdate = False
End If
'4. If doupdate = True, then download the latest program exe from the site
If doUpdate Then
'Note: This is all one line:
b() = InetUpdate.OpenURL(lbldownload.Caption, 1)
imgcircle2.Visible = False
Label2.Enabled = False
imgcircle3.Visible = True
Label3.Enabled = True
Open App.Path & "\" & lblexeupdate.Caption For Binary Access Write As #1
Put #1, , b()
Close 1
Kill App.Path & "\" & lblexeprogram.Caption
Name App.Path & "\" & lblexeupdate.Caption As App.Path & "\" & lblexeprogram.Caption
'Now save the current version into the local version file
Open App.Path & "\curversion.dat" For Output As #1
Print #1, strRemoteVer
Close 1
MsgBox "Update Complete!"
cmdDone.Enabled = True
End If
If err.Number = 13 Then
MsgBox "Please make sure you are connected to the Internet." & vbCrLf & "If not, please (re)connect to the Internet." & vbCrLf & vbCrLf & "If you suspect problems with this program" & vbCrLf & "please contact the author of the program or" & vbCrLf & "at ronnie@itson.nu" & vbCrLf & vbCrLf & "Auto Update Deluxe will shutdown", vbExclamation